<template>
  <div class="record_page">
    <navigate @answerBack="answerBack">咨询/预约记录</navigate>
    <div class="record_cont">
      <div class="tab_bar dis_flex just_center">
        <div
          class="item-tab tab_01 dis_flex just_center"
          :class="currentTab == 1 ? 'active_tab' : ''"
          @click="chooseTab(1)"
        >
          <span>咨询记录</span>
        </div>
        <div
          class="item-tab tab_02 dis_flex just_center"
          :class="currentTab == 2 ? 'active_tab' : ''"
          @click="chooseTab(2)"
        >
          <span>预约记录</span>
        </div>
      </div>
      <div class="list_box">
        <consult v-if="currentTab == 1" />
        <subscribe v-if="currentTab == 2" />
      </div>
    </div>
  </div>
</template>

<script>
import consult from "./components/consult.vue";
import subscribe from "./components/subscribe.vue";

export default {
  data() {
    return {
      currentTab: this.$route.query.currentTab || 1,
    };
  },
  components: {
    consult,
    subscribe,
  },

  methods: {
    answerBack() {
      this.$router.push({ path: "/nav/consult" });
    },
    chooseTab(v) {
      this.currentTab = v;
      this.$router.push({
        path: "/consultationRecord",
        query: { currentTab: v },
      });
    },
  },
};
</script>

<style lang="less" scoped>
.dis_flex {
  display: flex;
  align-items: center;
}
.just_center {
  justify-content: center;
}
.record_page {
  background-color: #f4f6fa;
  color: #333333;
}
.record_cont {
  padding: 10px 10px 0 10px;
}
//切换

.item-tab {
  width: 163.33px;
  height: 33.33px;
  line-height: 33.33px;
  background: #fff;
}
.tab_01 {
  border-radius: 6.67px 0 0 6.67px;
}

.tab_02 {
  border-radius: 0px 6.67px 6.67px 0px;
}
.active_tab {
  background: linear-gradient(0deg, #ffffff -20%, rgba(255, 255, 255, 0) 20%),
    #00aeff;
  color: #fff;
}
.item-tab img {
  width: 16.67px;
  height: 16.67px;
  margin-right: 9.67px;
}
.item-tab span {
  font-size: 14.67px;
  line-height: 14.67px;
  font-weight: bold;
}
.list_box {
  margin-top: 6.67px;
}
</style>
